package cn.rkylin.oms.system.flag.vo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import cn.rkylin.oms.system.flag.domain.Flag;

public class FlagVO extends Flag{

    /**
     * 
     */
    private static final long serialVersionUID = 8011762711498784385L;
    private static final Map<String,String> flagTypeMap = new HashMap<String,String>();

    static{
        flagTypeMap.put("OR","订单");
        flagTypeMap.put("PU","采购订单");
        flagTypeMap.put("RE","退货订单");
        flagTypeMap.put("SO","出库单");
        flagTypeMap.put("RD","退款单");
        flagTypeMap.put("TS","预售采购");
        flagTypeMap.put("EV","售后事件");
        flagTypeMap.put("IV","发票");
        flagTypeMap.put("TB","淘宝商品管理");
        flagTypeMap.put("GM","系统商品管理");
        flagTypeMap.put("CL","商品售价策略");
    }
    private static final String OPERATION_BTN_EDIT = "<button onclick=\"operationEdit(this)\" flagid=\"%s\" type=\"button\" class=\"btn btn-info btn-xs\"><i class=\"fa fa-edit\"></i>&nbsp;修改</button>";
    private static final String OPERATION_BTN_DELETE = "<button onclick=\"operationDelete(this)\" flagid=\"%s\" type=\"button\" class=\"btn btn-danger btn-xs\"><i class=\"fa fa-trash-o\"></i>&nbsp;删除</button>";
    private static final String FLAGPICTURE = "<i class=\"fa fa-flag\" style=\"color:%s\"></i>" ;
    /**
     * 搜索条件
     */
    private String searchCondition;
    /**
     * orderBy子句
     */
    private String orderBy;
    
    private String flagTypeName;
    private String flagShow;
    private String operation;
    private List<String> listEntId;
    
    public List<String> getListEntId() {
        return listEntId;
    }

    public void setListEntId(List<String> listEntId) {
        this.listEntId = listEntId;
    }

    public String getOperation() {
        StringBuffer opButton = new StringBuffer();
        if (StringUtils.isNotEmpty(getFlagId())) {
            opButton.append(String.format(OPERATION_BTN_EDIT, getFlagId()));
            opButton.append("&nbsp;");
            opButton.append(String.format(OPERATION_BTN_DELETE, getFlagId()));
        }
        this.operation = opButton.toString();
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public String getFlagTypeName() {
        return flagTypeMap.get(this.getFlagType());
    }

    public void setFlagTypeName(String flagTypeName) {
        this.flagTypeName = flagTypeName;
    }

    public String getFlagShow() {
        StringBuffer op = new StringBuffer();
        op.append(String.format(FLAGPICTURE, getColor()));
        return op.toString();
    }

    public void setFlagShow(String flagShow) {
        this.flagShow = flagShow;
    }

    public String getSearchCondition() {
        return searchCondition;
    }

    public void setSearchCondition(String searchCondition) {
        this.searchCondition = searchCondition;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }
    
    
    
}
